package com.oreilly.ez.fileserver.impl;

import com.oreilly.ez.fileserver.Exp;
import com.oreilly.ez.fileserver.IRule;
import com.oreilly.ez.fileserver.OP;
import com.oreilly.ez.fileserver.Result;

public class AddRule implements IRule {

    private OP op = OP.ADD;

    @Override
    public boolean canDo(Exp exp) {
        return op == exp.getOp();
    }

    @Override
    public Result doIt(Exp exp) {
        int result = exp.getA() + exp.getB();
        return new Result(result);
    }
}
